package com.www.applyword.ui.my;

import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.www.applyword.Constants.Constants;
import com.www.applyword.R;
import com.www.applyword.adapter.WordHopeAdapter;
import com.www.applyword.base.BaseActivity;
import com.www.applyword.bean.ResumeBean;
import com.www.applyword.http.CallBack;
import com.www.applyword.http.HttpClient;
import com.www.applyword.utils.SPUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.BindView;

/**
 * author : huang
 * date   : 2019/12/14 0014 16:41
 * version: 1.0
 */
public class ResumeWorkListActivity extends BaseActivity {
    @BindView(R.id.rl_word_time)
    RecyclerView rlWordTime;

    private WordHopeAdapter wordHopeAdapter;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.resume_work_activity);
        setTitle("历史工作纪录");
    }

    @Override
    protected void loadData() {
        rlWordTime.setLayoutManager(new LinearLayoutManager(ResumeWorkListActivity.this));
        rlWordTime.setItemAnimator(new DefaultItemAnimator());
        wordHopeAdapter = new WordHopeAdapter(ResumeWorkListActivity.this);
        rlWordTime.setAdapter(wordHopeAdapter);

        Map<String, Object> params = new HashMap<>();
        params.put("UserID", SPUtil.getString(Constants.USERID));
        params.put("Type", 1 + "");

        HttpClient.get(ResumeWorkListActivity.this, Constants.GETRESUMEWORKLIST, params,new CallBack<List<ResumeBean.ResumeWorkBean>>() {
            @Override
            public void onSuccess(List<ResumeBean.ResumeWorkBean> result) {
              //  resumeWork.addAll(result);
                if (result.size() > 0){
                    wordHopeAdapter.replaceAll(result, true);
                }else {
                    showEmpty(true, vsEmpty, 0);
                }
            }
        });
    }
}
